package com.jaws.core.endpoint;

import javax.annotation.Resource;

import org.springframework.boot.actuate.endpoint.AbstractEndpoint;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;

import feign.Client;

/**
 * jaws端点检查
 * @author maojian
 * @date 2018-06-25 14:21:46
 * @since v1.0.0
 */
public class FeignClientEndpoint extends AbstractEndpoint<String>{

	@Resource
	private ApplicationContext context;
	
	public FeignClientEndpoint() {
		super("jaws");
	}
	
	@Override
	public String invoke() {
		Environment env = super.getEnvironment();
		StringBuilder sb = new StringBuilder();
		sb.append("yjs.jaws.mock:").append(env.getProperty("yjs.jaws.mock", "false")).append(",")
		.append("client is:").append(context.getBean(Client.class).getClass().getName());
		return sb.toString();
	}

}
